<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小部件</title>
    <style>
        html,
        body,
        #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>
    <link href="https://js.arcgis.com/4.21/esri/themes/light/main.css" rel="stylesheet"/>
    <script src="https://js.arcgis.com/4.21/"></script>
    <script>
        require(["esri/Map", "esri/views/MapView", "esri/widgets/BasemapToggle"], (Map, MapView, BasemapToggle) => {
            let map = new Map({
                basemap:"topo-vector"
            });

            let view = new MapView({
                map:map,
                container:"viewDiv",
                center:[100.3, 33.9],
                zoom:4
            });

            let toggle = new BasemapToggle({
                label:"切换组件",
                view:view,//提供对地图的“topo-vector”底图的访问的视图
                nextBasemap:"hybrid",//允许切换到“混合”底图
            });

            view.ui.add(toggle,"bottom-left");//暴露视图中可用的默认小部件，并允许您打开和关闭它们
        });
    </script>
</head>
<body>
<div id="viewDiv">
</div>
</body>
</html>
